package com.bw.live_streaming.controller;

import java.util.Arrays;
import java.util.Map;

import com.bw.live_streaming.vo.InquiryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bw.live_streaming.entity.InquiryEntity;
import com.bw.live_streaming.service.InquiryService;
import com.bw.common.utils.PageUtils;
import com.bw.common.utils.R;


/**
 * 
 *
 * @author wj
 * @email sunlightcs@gmail.com
 * @date 2021-08-22 21:43:42
 */
@RestController
@RequestMapping("live_streaming/inquiry")
public class InquiryController {
    @Autowired
    private InquiryService inquiryService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = inquiryService.queryPage(params);

        return R.ok().put("page", page);
    }
    /**
     * 标签es列表
     */
    @RequestMapping("/lists")
    public R list(@RequestBody InquiryVo vo){
        System.out.println(vo);
        R lists = inquiryService.lists(vo);
        return R.ok().put("page", lists);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{inquiryId}")
    public R info(@PathVariable("inquiryId") Integer inquiryId){
		InquiryEntity inquiry = inquiryService.getById(inquiryId);

        return R.ok().put("inquiry", inquiry);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody InquiryEntity inquiry){
		inquiryService.save(inquiry);

        return R.ok();
    }
    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody InquiryEntity inquiry){
		inquiryService.updateById(inquiry);

        return R.ok();
    }
    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] inquiryIds){
		inquiryService.removeByIds(Arrays.asList(inquiryIds));

        return R.ok();
    }

}
